/*
 * @Description:导出excel
 * @Version: 2.0
 * @Autor: wiz
 * @Date: 2022-12-16 21:27:11
 * @LastEditors: wiz
 * @LastEditTime: 2023-11-18 12:40:50
 */
import lexicon from '@/lib/lexicon';
import { I_sort } from './base/sort';
import { T_stdReq } from './base/stdReq';

export class T_expExcel extends T_stdReq {
  private url: string = lexicon.url.exportXLSX;

  protected fileName: string;

  protected fields: Array<string>;

  protected filter: object;

  protected sort: I_sort[];

  protected globalSearch?: string = null;

  constructor() {
    super();
    this.sort = [];
    this.fields = [];
  }

  public setFields(...p: string[]): T_expExcel {
    this.fields.push(...p);
    return this;
  }

  public setFilter(p: object): T_expExcel {
    this.filter = p;
    return this;
  }

  public setSort(...p: I_sort[]): T_expExcel {
    this.sort.push(...p);
    return this;
  }

  public setFileName(p: string): T_expExcel {
    this.fileName = p;
    return this;
  }

  public setGllobalSearch(p: string): T_expExcel {
    this.globalSearch = p;
    return this;
  }
}

export interface I_expExcel extends T_expExcel {}
